#pragma once

#include "base.h"
#include <osg/BoundingBox>
#include <osg/Vec3>
#include "corebase_global.h"

namespace osg
{
   class Node;
}

namespace CoreBase
{
   class Scene;
   class DrawablePrivate;
   class ActorBase;

   class COREBASE_EXPORT Drawable : public CoreBase::Base
   {
   public:
      virtual osg::Node* getOSGNode() = 0;
      virtual const osg::Node* getOSGNode() const = 0;
      virtual void addedToScene(Scene* scene);
      virtual void removedFromScene(Scene* scene);
      virtual void setParent(Drawable* parent);
      Drawable* getParent();
      const Drawable* getParent() const;
      Scene* getSceneParent();
      const Scene* getSceneParent() const;
      virtual bool addChild(Drawable* child);
      virtual void removeChild(Drawable* child);
      //void Emancipate();
      unsigned int getNumChildren() const;
      Drawable* getChild(unsigned int idx);
      const Drawable* getChild(unsigned int idx) const;
      unsigned int getChildIndex(const Drawable* child) const;
      bool canBeChild(Drawable* child) const;
      virtual void getBoundingSphere(osg::Vec3& center, float& radius);
      virtual osg::BoundingBox getBoundingBox();
      virtual void setActive(bool enable);
      virtual bool getActive() const;
      void setDescription(const QString& description);
      const QString& getDescription() const;
	  void OnOrphaned();
	  ActorBase* getOwnerActor()
	  {
		  return _ownerActor;
	  }
   protected:
      Drawable(ActorBase* owneractor,const QString& name = "Drawable");
      virtual ~Drawable();
      //virtual void OnOrphaned();
	  ActorBase*		_ownerActor;
   private:
      Drawable& operator=(const Drawable&);
      Drawable(const Drawable&);
      DrawablePrivate*	_pvt;
   };
}